# -*- coding: utf-8 -*-
import threading
import time
import base
from Message.models import *

# 为线程定义一个函数
def taskdo(threadName, delay):

    while True:
        mscount = Message.objects.filter().count()
        print('每隔10秒执行函数---',mscount)
        time.sleep(delay)

if __name__ == "__main__":
    
    print("执行thread任务")
    # _thread.start_new_thread(taskdo,('参数',5))
    # thread_hi = threading.Thread(target=test_thread)
    taskdo = threading.Thread(target=taskdo,args=('参数',5))
    taskdo.start()

# try:
#     _thread.start_new_thread(taskdo,('参数',5))
# except :
#     pass